package com.lsa.letcode.the206.reverseLinkedList;

import org.junit.Test;

import com.lsa.letcode.common.LetCodeTestBase;
import com.lsa.letcode.common.ListNode;

public class ReverseLinkedListTest extends LetCodeTestBase {
	@Test
	public void test() throws Exception {
		test(asList(1), asList(1));
		test(asList(1, 2), asList(2, 1));
		test(asList(1, 2, 3, 4, 5), asList(5, 4, 3, 2, 1));
		test(asList(1, 2, 3, 4, 5, 6), asList(6, 5, 4, 3, 2, 1));
	}

	private void test(ListNode l, ListNode expected) {
		Solution s = new Solution();
		ListNode res = s.reverseList(l);
		assertEqual(expected, res);
	}
}
